package com.gitee.wsl.ext.bitcode

/** Returns the number of leading zeros of the bits of [this] integer */
fun Int.countLeadingZeros(): Int = this.countLeadingZeroBits()

/** Returns the number of trailing zeros of the bits of [this] integer */
 fun Int.countTrailingZeros(): Int = this.countTrailingZeroBits()

/** Returns the number of leading ones of the bits of [this] integer */
 fun Int.countLeadingOnes(): Int = this.inv().countLeadingZeros()

/** Returns the number of trailing ones of the bits of [this] integer */
 fun Int.countTrailingOnes(): Int = this.inv().countTrailingZeros()

fun Long.countLeadingZeros() = this.countLeadingZeroBits()

/** Returns the number of trailing zeros of the bits of [this] integer */
fun Long.countTrailingZeros() = this.countTrailingZeroBits()

/** Returns the number of leading ones of the bits of [this] integer */
fun Long.countLeadingOnes() = this.inv().countLeadingZeros()

/** Returns the number of trailing ones of the bits of [this] integer */
fun Long.countTrailingOnes() = this.inv().countTrailingZeros()